package org.ciallo.simplemusicplayer.data.model;

import java.util.Objects;

/**
 * @author Jukomu
 * @Description: 用于在UI上显示歌单信息的模型，包含动态获取的封面
 * @Package: org.ciallo.simplemusicplayer.data.model
 * @Project: SimpleMusicPlayer
 * @name: PlaylistInfo
 * @Date: 2025/6/3-02:52
 * @Filename: PlaylistInfo
 */
public class PlaylistInfo {
    public long id;
    public String name;
    public String description;
    public long creationDate;
    public int songCount;
    public String displayCoverArtUri; // 用于显示的封面URI (可以是第一首歌的，或固定图标)

    // 特殊歌单类型标记 (可选，但有助于区分)
    public static final int TYPE_NORMAL_PLAYLIST = 0;
    public static final int TYPE_FAVORITES_PLAYLIST = 1;
    public int playlistType;


    // 构造函数用于普通歌单
    public PlaylistInfo(long id, String name, String description, long creationDate, int songCount, String displayCoverArtUri) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.creationDate = creationDate;
        this.songCount = songCount;
        this.displayCoverArtUri = displayCoverArtUri;
        this.playlistType = TYPE_NORMAL_PLAYLIST;
    }

    // 构造函数用于特殊歌单 (如“我的收藏”)
    public PlaylistInfo(long id, String name, int songCount, String fixedCoverArtUri, int type) {
        this.id = id;
        this.name = name;
        this.description = ""; // 特殊歌单可能没有描述
        this.creationDate = 0; // 或一个特定值
        this.songCount = songCount;
        this.displayCoverArtUri = fixedCoverArtUri;
        this.playlistType = type;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PlaylistInfo that = (PlaylistInfo) o;
        return id == that.id &&
                creationDate == that.creationDate &&
                songCount == that.songCount &&
                playlistType == that.playlistType &&
                Objects.equals(name, that.name) &&
                Objects.equals(description, that.description) &&
                Objects.equals(displayCoverArtUri, that.displayCoverArtUri);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, description, creationDate, songCount, displayCoverArtUri, playlistType);
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public long getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(long creationDate) {
        this.creationDate = creationDate;
    }

    public int getSongCount() {
        return songCount;
    }

    public void setSongCount(int songCount) {
        this.songCount = songCount;
    }

    public String getDisplayCoverArtUri() {
        return displayCoverArtUri;
    }

    public void setDisplayCoverArtUri(String displayCoverArtUri) {
        this.displayCoverArtUri = displayCoverArtUri;
    }

    public int getPlaylistType() {
        return playlistType;
    }

    public void setPlaylistType(int playlistType) {
        this.playlistType = playlistType;
    }
}
